package com.example.lol.ui.adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.lol.R;
import com.example.lol.ui.bean.NewBean2;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class NewsAdapter3 extends BaseMultiItemQuickAdapter<NewBean2, BaseViewHolder> {
    public  NewsAdapter3(List<NewBean2> data){
        super(data);
        addItemType(NewBean2.TYPE1, R.layout.fragment_home_3);
        addItemType(NewBean2.TYPE2,R.layout.item_1);
        addItemType(NewBean2.TYPE3,R.layout.item_2);
    }
    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, NewBean2 newBean2) {
        switch (baseViewHolder.getItemViewType()){
            case NewBean2.TYPE1:
                break;
            case NewBean2.TYPE2:
                baseViewHolder.setText(R.id.tv_news_title, newBean2.getTitle());
                baseViewHolder.setText(R.id.tv_hot, newBean2.getHot());
                baseViewHolder.setImageResource(R.id.img_cover, newBean2.getDrawable());
                baseViewHolder.setImageResource(R.id.tv_lol,newBean2.getLol());
                baseViewHolder.setImageResource(R.id.tv_icon,newBean2.getIcon());
                baseViewHolder.setText(R.id.tv_number,newBean2.getNumber());
                break;
            case NewBean2.TYPE3:
                baseViewHolder.setText(R.id.tv_news_title_1, newBean2.getTitle());
                baseViewHolder.setText(R.id.tv_hot_1, newBean2.getHot());
                baseViewHolder.setImageResource(R.id.img_cover_1, newBean2.getDrawable());
                baseViewHolder.setImageResource(R.id.tv_lol_1,newBean2.getLol());
                baseViewHolder.setImageResource(R.id.tv_icon_1,newBean2.getIcon());
                baseViewHolder.setText(R.id.tv_number_1,newBean2.getNumber());
                break;
        }

    }
}
